# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer: Simon Zeni <simon@bl4ckb0ne.ca>
pkgname=stb
pkgver=0_git20231012
_commit=beebb24b945efdea3b9bba23affb8eb3ba8982e7
pkgrel=0
pkgdesc="Single-file public domain (or MIT licensed) libraries for C/C++"
url="https://github.com/nothings/stb"
arch="noarch"
license="MIT"
# tests always return 0 exit code
options="!check"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/nothings/stb/archive/$_commit.tar.gz
	CVE-2023-43898.patch
	CVE-2023-45661.patch
	CVE-2023-45662.patch
	CVE-2023-45663.patch
	CVE-2023-45664.patch
	CVE-2023-45666.patch
	CVE-2023-45667.patch
	CVE-2023-45675.patch
	convert-8-to-16-overflow.patch
	jpeg-decode-block-overflow.patch
	load-gif-main-overflow.patch
	stb.pc
	"
builddir="$srcdir/$pkgname-$_commit"

# secfixes:
#   0_git20231012-r0:
#     - CVE-2023-43898
#     - CVE-2023-45661
#     - CVE-2023-45662
#     - CVE-2023-45663
#     - CVE-2023-45664
#     - CVE-2023-45666
#     - CVE-2023-45667
#     - CVE-2023-45675

package() {
	install -Dm644 ./stb_*.h -t "$pkgdir"/usr/include
	install -Dm644 docs/* -t "$pkgdir"/usr/share/doc/"$pkgname"
	install -Dm644 "$srcdir"/stb.pc -t "$pkgdir"/usr/lib/pkgconfig
	sed -i "s|@PKGVER@|$pkgver|" "$pkgdir"/usr/lib/pkgconfig/stb.pc
}

sha512sums="
83f09092340f158772c467d2069309c06a7c888d710ea651a974d7be47391d78be36b76e4ad32a38972da5e78561ea8fa13a9e20a81c1b89ff00e8f3dd73c8ed  stb-0_git20231012.tar.gz
4a6cefb0e0aed1e908f647cd5ecd2e43221fa302c6e7367dc70036272026ebfae1d1c6db64ddf5c47a60078f6159e682541388f4a470a52109b95068f247d1df  CVE-2023-43898.patch
9d16c69b3b48d2173813e063f97c3a6ee6d3b61601887e2523e63ea0306a06a9dc2d8f2c01041c25a006fb7a63764056e179bd04a55024a0e16747a6900dd39b  CVE-2023-45661.patch
3d40fbda1d1628e85875c61c7bfd6a88b099e93acde627852f03d4250006cf3d0f00f61ddd8d7569ae0894ae4145ec8cf3719a3f93929928928ed0056a80cb1b  CVE-2023-45662.patch
a88bd27958d235ed6d912f1436f8e682fcab9e9863182d6b5c9f530acf1c3b2f23efc3bc88c94a95d38bb24141e81dc48da6452a08b855ee62445963a62769e8  CVE-2023-45663.patch
029934d6315fde30a6dc3043cc9f7609400cf898491da60b24c864702f6a8903259679b2e6eff310caead842e067f2a007690c45dbb73b88fde8b69db239163a  CVE-2023-45664.patch
429dad52fc5ebed72de4e3d87d5c16fdc804503c9a17f6e004e8e14c9eb56251be6ffd2e74c45e72b8360543d2de26f23988db8945a9a222317d7e431ca2a1ad  CVE-2023-45666.patch
26eb106ba23877463329a92f9309540b1b73952ee754d4c1a87ae9f607e7eb6ba09d38ca21bbd2596c1b8cc0e3f951e786fd587c390f236fe609e49ea527f8c9  CVE-2023-45667.patch
d8ca3cf40e78670b937547cf870521a1cdd366e87f32a51795797d48d177a63a3e81963c9223b71971433b9a646aa4419cfa29ee0c612f4863fd78b5dd3e5d8d  CVE-2023-45675.patch
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e  convert-8-to-16-overflow.patch
1a849cd98ac8861210d4bacff32bb7e567e79b25d6bceb79f48133ceb914b11e7daf0150e618e3f7afe0708d1f1205067a505b9ba5b49cc48427b531057862ff  jpeg-decode-block-overflow.patch
67711b9323c59594115cbf9461c8f32239d526e7a4be62ce7f1b2c3a9b114e64e61bf6f8082a691a4fa19a73ca66c40e768e5784358037f8ba5b87b0d103586a  load-gif-main-overflow.patch
e32e29628a8580dbeb574cbd9427377d8d49d31f4785c15589ae7315c6ac534882cde659a50a3000098cd9dd3d5c4596997d1fdf9ced9c569f424774aa8f5776  stb.pc
"
